<template>
    <div id="nav">
       <el-radio-group v-model="isCollapse" style="margin-bottom: 20px;">
        <el-radio-button :label="false">展开</el-radio-button>
        <el-radio-button :label="true">收起</el-radio-button>
      </el-radio-group>
        <el-menu :default-active="activeIndex" class="el-menu-vertical-demo"  :collapse="isCollapse" active-text-color="#42b983" text-color="#ccc">
          <div v-for="(item,index) in navBox" :key="index"  @click="navClick(item.path)">
            <el-menu-item :index="item.name">
                <i :class="item.icon"></i>
                <span slot="title">{{item.name}}</span>
            </el-menu-item>
          </div>
        </el-menu>
    </div>
</template>
<script>
  export default {
    data() {
      return {
        isCollapse: false,
        activeIndex:'app1',
        navBox:[
          {name:'app1',icon:'el-icon-location',path:'/app1'},
          {name:'app2',icon:'el-icon-menu',path:'/app2'},
          {name:'app3',icon:'el-icon-document',path:'/app3'}
          ]
      };
    },
    mounted(){
    },
    methods: {
      navClick(path) {
        this.$router.push(path)
      }
    }
  }
</script>
<style  scoped>
#nav a {
  font-weight: bold;
  color: #2c3e50;
}

#nav a.router-link-exact-active {
  color: #42b983;
}

.el-menu-vertical-demo:not(.el-menu--collapse) {
    width: 200px;
    min-height: 400px;
  }
</style>
